home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / html / vendors / charybda / software / RemoveIt2.csh < prev   
Linux/UNIX/POSIX Shell Script  |  1997-07-26  |  1KB  |  65 lines

  1. #!/bin/csh -f
  2.  
  3. set INST_DIR=charybda
  4.  
  5. set TID="$TMPFILEDIR/charybda"
  6. if ( -w $TID ) then
  7.     set  INST_PATH=$TID
  8. else
  9.     LOOP1:
  10.     echo " "
  11.     echo "Enter the name of the directory where Charybda "
  12.     echo "is installed ( q to quit ) :  \c"
  13.     set INST_PATH = $<
  14.  
  15.     if ($#INST_PATH == 0 ) then
  16.         echo " "
  17.         echo "Input Error.  Please try again."
  18.         goto LOOP1
  19.     else if ( $INST_PATH == 'q' ) then
  20.         echo " "
  21.         echo ... Bye"
  22.         sleep 3
  23.         exit
  24.     endif
  25.     if ( ! -d $INST_PATH ) then
  26.         echo " "
  27.         echo "Can't find the $INST_PATH directory."
  28.         echo " "
  29.         echo "Press Enter to quit, and then try again.  \c"
  30.         set a = $<
  31.         \rm -f $TMPFILEDIR$INST_DIR > /dev/null
  32.         exit -1
  33.     endif
  34. endif
  35.  
  36. echo " "
  37. echo "About to remove the entire $INST_PATH directory."
  38. LOOP2:
  39. echo " "
  40. echo "Continue (y/n)?  \c"
  41. set a = $<
  42. if ( $a == 'n' ) then
  43.     exit -1
  44. else if ( $a == 'y' ) then
  45. else
  46.     goto LOOP2
  47. endif
  48.  
  49. if ( -w $INST_PATH ) then
  50.     \rm -rf $INST_PATH
  51. else
  52.     echo " "
  53.     echo "You have no permission to remove the $INST_PATH directory"
  54.     echo " "
  55.     su - root -c "/bin/rm -rf $INST_PATH"
  56. endif
  57. \rm -f $TMPFILEDIR$INST_DIR > /dev/null
  58.  
  59. echo " "
  60. echo "Removal Complete\!"
  61. echo " "
  62. echo "Press Enter to exit this window...  \c"
  63. set a = $<
  64.  
  65.